/**
 author: chengzheng
 date: 2017/12/27
 email: 13120207061@163.com
 */

const Consumer = require('../work/consumer');

class DemoConsumer extends Consumer {
    constructor(option) {
        super(option);
    }

    beforeParseHtml(result) {
        return !!result;
    }

    parseHtml(result) {
        return result;
    }

    afterCrawlRequest(result) {
        console.log('result:', result);
    }
}

let demoConsumer = new DemoConsumer({
    channel: 'demo',
    sleepTime: 5000,
    deviceType: 'pc',
    dbConf: {
        redis: {
            host: 'localhost',
            port: 6379,
        }
    }
});
demoConsumer.go().then(() => {
    console.log("consumer done");
});